package testEvent;

import junit.framework.TestCase;

import org.junit.*;

import event.*;

import player.*;

public class testEventController extends TestCase {
	
	@After
	public void tearDown() {}
	
	
	// Wrote by Ken on 29/2/2012
	// Test a method called "update(player, int )" in the "EventController" class
	// The situation is when the controller want to add 1 points to the player
	@Test
	public void testUpdateSEpoint(){
		Player tom = new Player();
		
		int beforeAnswer = tom.getSEPoint();
		
		// Get the question right
		
		EventController eC = new EventController();
		
		// Add 1 SE point to user
		// the update is a void method
		eC.update(tom, 1);
		
		int afterAnswer = tom.getSEPoint();
		
		int ExpectedResult = beforeAnswer + 1;
		
		assertEquals(ExpectedResult, afterAnswer );
		
	}
	
	// Wrote by Raymond on 1/3/2012
	// Test a method called "update(player, int )" in the "EventController" class
	// The situation is when the controller want to delete 1 points to the player
	@Test
	public void testUpdateSEpoint(){
		Player ken = new Player();
		
		int beforeAnswer = ken.getSEPoint();
		
		// Get the question Wrong
		
		EventController eC = new EventController();
		
		// Add 1 SE point to user
		// the update is a void method
		eC.update(ken, -1);
		
		int afterAnswer = ken.getSEPoint();
		
		int ExpectedResult = beforeAnswer - 1;
		
		assertEquals(ExpectedResult, afterAnswer );
		
	}
	
}